On one of pyxc_domain_getinfo's error paths, free the block allocated
authoremellor@ewan <emellor@ewan>
Wed, 21 Sep 2005 10:24:26 +0000 (11:24 +0100)
committeremellor@ewan <emellor@ewan>
Wed, 21 Sep 2005 10:24:26 +0000 (11:24 +0100)
previously.  This would have caused a memory leak when attempting to get info
on a domain that does not exist.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/lowlevel/xc/xc.c

index d7452fabd13caf252e1495444be42667ee098662..ef4c58d3e959ec90f1a43b56e0dec95980cb7652 100644 (file)
@@ -222,8 +222,11 @@ static PyObject *pyxc_domain_getinfo(PyObject *self,
     nr_doms = xc_domain_getinfo(xc->xc_handle, first_dom, max_doms, info);
 
     if (nr_doms < 0)
+    {
+        free(info);
         return PyErr_SetFromErrno(xc_error);
-    
+    }
+
     list = PyList_New(nr_doms);
     for ( i = 0 ; i < nr_doms; i++ )
     {